package it.unive.taw;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestSet extends HttpServlet {
  public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
    
     
    Cookie cookie = new Cookie("Session-Cookie","Cookie-Value-S");
    response.addCookie(cookie);

    cookie = new Cookie("Persistent-Cookie","Cookie-Value-P");
      
    cookie.setMaxAge(60*60*24);
    response.addCookie(cookie);
    
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println (("<HTML><HEAD><TITLE>Impostazione Cookie</TITLE></HEAD>" +
       "<BODY><H1 >Impostazione Cookie</H1>Prova impostazione 2 cookie</BODY></HTML>"));
  }
}
